﻿

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>新增角色</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
        <div class="layui-form-item">
            <label class="layui-form-label">角色名称</label>
            <div class="layui-input-inline">
                <input type="text" name="rolesname" id="rolesname" lay-verify="required" placeholder="请输入角色名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">角色描述</label>
            <div class="layui-input-inline">
                <input type="text" name="rolesremark" id="rolesremark" lay-verify="required" placeholder="请输入角色描述" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">权限范围</label>
            <div class="layui-input-block" id="list_function">
            
            </div>
        </div>

        <div class="layui-form-item" lay-filter="sex">
            <label class="layui-form-label">是否可用</label>
            <div class="layui-input-block">
                <input type="checkbox" id="isactive" checked="" name="open" lay-skin="switch" lay-filter="component-form-switchTest" lay-text="可用|禁用">
               
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
        </div>
    </div>
    <script src="../../../layuiadmin/js/jquery.min2.1.4.js"></script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/js/jshelp.js"></script>
    <script>
       
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload'], function () {
            var $ = layui.$
                , form = layui.form
                , upload = layui.upload;

            $.ajax({
                url: 'ashx/list.ashx?type=getlist_function',
                type: 'GET',
                success: function (data) {
                    var str = "";
                    for (var i = 0; i < data.data.length; i++) {
                        str += '<input type="checkbox" id="' + data.data[i].id + '" value="' + data.data[i].id+'" name="functionnames" lay-skin="primary" title="' + data.data[i].name+'">';
                    }
                    $("#list_function").append(str);
                    form.render('checkbox');
                }
            })
           
   
        })
    </script>
</body>
</html>